package com.tvunetworks.center.device.config.datasource;

/**
 * @author Ethan
 * @data: 2021/6/15 14:12
 * @program:
 * @description:
 */
public class DataSourceContextHolder {

	private static final ThreadLocal<String> LOCAL = new ThreadLocal<String>();

	public static ThreadLocal<String> getLocal() {
		return LOCAL;
	}

	/**
	 * 读可能是多个库
	 */
	public static void read() {
		LOCAL.set(DataSourceType.read.getType());
	}

	/**
	 * 写只有一个库
	 */
	public static void write() {
		LOCAL.set(DataSourceType.write.getType());
	}

	public static String getJdbcType() {
		return LOCAL.get();
	}
}